package com.wlyuan.open.scanner.utils.enums.named;

import com.wlyuan.core.marker.NamedValue;
import com.wlyuan.core.marker.NamedValueMap;
import com.wlyuan.core.named.BillingUnit;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Map;

/**
 * @author lijing
 * @description
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum PriceUnitEnum implements NamedValue<Integer> {

    KILO(1, BillingUnit.KG.getValue(), "公斤"),
    TONNE(2, BillingUnit.T.getValue(), "吨"),
    CUBIC(3, BillingUnit.CBM.getValue(), "立方米"),
    LITRE(4, BillingUnit.LTR.getValue(), "升"),
    INDIVIDUAL(5, BillingUnit.EACH.getValue(), "个"),
    TORR(6, BillingUnit.PALLET.getValue(), "托"),
    PLATFORM(7, BillingUnit.SET.getValue(), "台"),
    BOX(8, BillingUnit.CONTAINER.getValue(), "箱"),
    PACKET(9, BillingUnit.BALE.getValue(), "包"),
    BUNDLE(10, BillingUnit.BUNDLE.getValue(), "捆"),
    VEHICLES(11, BillingUnit.VEHICLE.getValue(), "辆"),
    PIECE(12, BillingUnit.PIECE.getValue(), "件"),
    BAG(13, BillingUnit.BAG.getValue(), "袋"),
    RACK(14, BillingUnit.FRAME.getValue(), "架"),
    SMALL_BOX(15, BillingUnit.BOX.getValue(), "盒"),
    BUCKET(16, BillingUnit.BUCKET.getValue(), "桶"),
    OTHER(17, BillingUnit.OTHER.getValue(), "其他");

    private final Integer value;
    private final Integer newValue;
    private final String name;

    private static final Map<Integer, PriceUnitEnum> MAP = new NamedValueMap<>(PriceUnitEnum.class);

    public static PriceUnitEnum fromValue(Integer value) {
        return MAP.get(value);
    }
}
